home *** CD-ROM | disk | FTP | other *** search
- /************************************************/
- /* Sample DLL's */
- /* Copyright © Vincent Parsons 1989. */
- /************************************************/
- /* DLL code for MPW C 3.0 or THINK C 4.0 */
- /* with Excel for the Macintosh 2.2 */
- /* and Microsoft C 5.1 */
- /* with Excel for Windows 2.1 */
- /************************************************/
- /* SampBBB is an example of two data type B */
- /* inputs and one data type B output. The */
- /* output is the product of the two inputs. */
- /************************************************/
- /* =REGISTER("SampDLLs","SampBBB","BBB") */
- /* for both the Mac and the PC. */
- /************************************************/
- /*
- Note that the floating point numbers
- are passed as double64 * on the Mac and
- double64 on the PC.
-
- The function type is pascal double64 * on the
- Mac and double64 far * far pascal on the PC.
-
- On the Mac the returned value is d1 (a pointer
- to the double64 result) and the answer has been
- stored in the Excel buffer used by the input
- variable.
-
- On the PC the answer is stored in a static
- variable and the returned value is a pointer
- to that static value.
-
- This was done so the REGISTER command is the
- same in the PC and the Mac.
- */
- /************************************************/
-
- #include "DLL.h"
-
- #if applec
- #include <Types.h>
-
- #elif MSDOS
- #include <windows.h>
-
- #endif
-
- #if THINK_C
- pascal double64 * main(double64 * d1, double64 * d2); /* prototype */
-
- pascal double64 * main(d1, d2)
- double64 * d1;
- double64 * d2;
-
- #elif applec
- pascal double64 * SampBBB(double64 * d1, double64 * d2)
-
- #elif MSDOS
- double64 far * far pascal SampBBB(double64 d1, double64 d2)
- #endif
- {
- #if applec | THINK_C
- double64 answer;
-
- /* Returned parameter is the product of the two inputs */
- answer = *d1 * *d2;
- *d1 = answer; /* Store value in Excel data buffer since static */
- return ( d1 ); /* variables are not permitted in Mac code resources */
-
- #elif MSDOS
- static double64 answer;
-
- /* Returned parameter is the product of the two inputs */
- answer = d1 * d2;
- return ( (double64 far *)&answer );
-
- #endif
- }
-
- /************************************************/
-
-